/**
 * Review路由模块
 */

var express = require('express');
var router = express.Router();

const review = require("../controller/review");
const auth = require("../controller/auth");

// 定义路由
// 守卫路由：所有路由必须执行权限控制的判断
router.all("*", auth.isLogin);

router.get("/user/count", review.getCountByUserId);

router.get("/user", review.findAllByUserId);

router.patch("/useful/:id", review.updateUseful);

router.patch("/useless/:id", review.updateUseless);

router.get("/count",review.getCount)

router.get("/:id", review.find);

router.get("/", review.findAll);

router.post("/", review.add);

router.put("/:id", review.update);

router.delete("/:id", review.remove);

module.exports = router;